<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('db limit list')" />
	<th:block th:include="include :: layout-latest-css" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="form">
					<input type="hidden" id="pageFlag" name="pageFlag" th:value="${dbLimit.pageFlag}"/>
					<div class="select-list">
						<ul>
							<li class="select-time">
								<label>考评月份： </label>
								<input type="text" class="" id="monthId" name="monthId" th:value="${dbLimit.monthId}"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a style="margin-left:20px;" class="btn btn-warning btn-rounded btn-sm" onclick="export1()"
									th:if="${'SUBMIT' != dbLimit.pageFlag}">
									<i class="fa fa-download"></i> 导出
								</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<th:block th:include="include :: datetimepicker-css" />
	<th:block th:include="include :: datetimepicker-js" />
	<script th:inline="javascript">
		var prefix = ctx + "rate/dbLimit";
		var khzDict = [[${@dict.getType('rate_khz')}]];
		var pageFlag = [[${dbLimit.pageFlag}]];

		$(function() {
			$("#monthId").datetimepicker({
				format: 'yyyy-mm',
				weekStart: 1,
				autoclose: true,
				startView: 3,
				minView: 3
			});
			list();
		});

		function list() {
			var cols = [];
			cols.push({
				field: 'id',
				visible: false
			});
			cols.push({
				field: 'khz',
				align: 'center',
				title: '考核组',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(khzDict, value);
				}
			});
			cols.push({
				field: 'dept.deptName',
				align: 'center',
				title: '考核<br/>部门'
			});
			cols.push({
				field: 'downDesc',
				align: 'center',
				title: '低分<br/>情况'
			});
			cols.push({
				field: 'midDesc',
				align: 'center',
				title: '中分<br/>情况'
			});
			cols.push({
				field: 'upDesc',
				align: 'center',
				title: '高分<br/>情况'
			});
			cols.push({
				field: 'checkResult',
				align: 'center',
				title: '督办<br/>结果',
				formatter: function(value, row, index) {
					if ("APPROVED" == value) {
						// return '<i class="fa fa-check"></i>';
						return '<span style="color:limegreen;font-weight:bold;font-size:15px;">&#10004</span>';
					} else {
						// return '<i class="fa fa-close"></i>';
						return '<span style="color:red;font-weight:bold;font-size:15px;">&#10006</span>';
					}
				}
			});
			cols.push({
				field: 'checkDesc',
				align: 'center',
				title: '结果<br/>描述'
			});
			/**
			cols.push({
				title: '操作',
				align: 'center',
				width: '30%',
				formatter: function(value, row, index) {
					var actions = [];
					actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
					actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="remove1(\'' + row.id + '\')"><i class="fa fa-times"></i>删除</a> ');
					actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="view(\'' + row.id + '\')"><i class="fa fa-query"></i>查看</a> ');
					return actions.join('');
				}
			});
			**/
			
			var options = {
				url: prefix + "/dbLimitCheckList",
				modalName: "督办结果",
				uniqueId: "id",
				pagination: false,
				columns: cols
			};
			$.table.init(options);
		}
		
		function export1() {
			if ($("#monthId").val() == '') {
				$.modal.alertWarning("请选择考核月份！");
				return false;
			}
			
			$.modal.confirm("确定导出所有考核结果吗？", function() {
				var dataParam = {"monthId": $("#monthId").val(), "pageFlag":pageFlag};
				$.post(prefix + "/exportDbLimitCheckList", dataParam, function(result) {
					if (result.code == web_status.SUCCESS) {
				        window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
					} else if (result.code == web_status.WARNING) {
	                    $.modal.alertWarning(result.msg)
	                } else {
						$.modal.alertError(result.msg);
					}
					$.modal.closeLoading();
				});
			});
		}
	</script>
</body>
</html>